home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / AIncludes / TranslationExtensions.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  5.2 KB  |  173 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        TranslationExtensions.a
  3. ;
  4. ;    Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5. ;
  6. ;    Version:    Technology:    Macintosh Easy Open 1.1
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1989-1993, 1995, 1997-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__TRANSLATIONEXTENSIONS__') = 'UNDEFINED' THEN
  18. __TRANSLATIONEXTENSIONS__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  24.     include 'Files.a'
  25.     ENDIF
  26.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  27.     include 'Quickdraw.a'
  28.     ENDIF
  29.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  30.     include 'Components.a'
  31.     ENDIF
  32.  
  33.  
  34. kSupportsFileTranslation        EQU        1
  35. kSupportsScrapTranslation        EQU        2
  36. kTranslatorCanGenerateFilename    EQU        4
  37.  
  38. ;  better names for 4-char codes
  39. ; typedef OSType                         FileType
  40.  
  41. ; typedef ResType                         ScrapType
  42.  
  43. ; typedef unsigned long                 TranslationAttributes
  44.  
  45.  
  46. taDstDocNeedsResourceFork        EQU        1
  47. taDstIsAppTranslation            EQU        2
  48.  
  49. FileTypeSpec            RECORD 0
  50. format                     ds.l    1                ; offset: $0 (0)
  51. hint                     ds.l    1                ; offset: $4 (4)
  52. flags                     ds.l    1                ; offset: $8 (8)        ;  taDstDocNeedsResourceFork, taDstIsAppTranslation
  53. catInfoType                 ds.l    1                ; offset: $C (12)
  54. catInfoCreator             ds.l    1                ; offset: $10 (16)
  55. sizeof                     EQU *                    ; size:   $14 (20)
  56.                         ENDR
  57. FileTranslationList        RECORD 0
  58. modDate                     ds.l    1                ; offset: $0 (0)
  59. groupCount                 ds.l    1                ; offset: $4 (4)
  60. ;      unsigned long    group1SrcCount;
  61. ;      unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);
  62. ;   FileTypeSpec    group1SrcTypes[group1SrcCount]
  63. ;   unsigned long    group1DstCount;
  64. ;   unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);
  65. ;   FileTypeSpec    group1DstTypes[group1DstCount]
  66. sizeof                     EQU *                    ; size:   $8 (8)
  67.                         ENDR
  68. ; typedef struct FileTranslationList *    FileTranslationListPtr
  69.  
  70. ; typedef FileTranslationListPtr *        FileTranslationListHandle
  71.  
  72.  
  73. ScrapTypeSpec            RECORD 0
  74. format                     ds.l    1                ; offset: $0 (0)
  75. hint                     ds.l    1                ; offset: $4 (4)
  76. sizeof                     EQU *                    ; size:   $8 (8)
  77.                         ENDR
  78. ScrapTranslationList    RECORD 0
  79. modDate                     ds.l    1                ; offset: $0 (0)
  80. groupCount                 ds.l    1                ; offset: $4 (4)
  81. ;      unsigned long        group1SrcCount;
  82. ;      unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);
  83. ;   ScrapTypeSpec        group1SrcTypes[group1SrcCount]
  84. ;   unsigned long        group1DstCount;
  85. ;      unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);
  86. ;   ScrapTypeSpec        group1DstTypes[group1DstCount]
  87. sizeof                     EQU *                    ; size:   $8 (8)
  88.                         ENDR
  89. ; typedef struct ScrapTranslationList *    ScrapTranslationListPtr
  90.  
  91. ; typedef ScrapTranslationListPtr *        ScrapTranslationListHandle
  92.  
  93. ;  definition of callbacks to update progress dialog
  94. ; typedef long                             TranslationRefNum
  95.  
  96. ; *****************************************************************************************
  97. ;*
  98. ;* This routine sets the advertisement in the top half of the progress dialog.
  99. ;* It is called once at the beginning of your DoTranslateFile routine.
  100. ;*
  101. ;* Enter:    refNum            Translation reference supplied to DoTranslateFile.
  102. ;*            advertisement    A handle to the picture to display.  This must be non-purgable.
  103. ;*                            Before returning from DoTranslateFile, you should dispose
  104. ;*                            of the memory.  (Normally, it is in the temp translation heap
  105. ;*                            so it is cleaned up for you.)
  106. ;*
  107. ;* Exit:    returns            noErr, paramErr, or memFullErr
  108. ;
  109.  
  110. ;
  111. ; pascal OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
  112. ;
  113.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  114.         Macro
  115.         _SetTranslationAdvertisement
  116.             moveq               #2,D0
  117.             dc.w                $ABFC
  118.         EndM
  119.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  120.         IMPORT_CFM_FUNCTION SetTranslationAdvertisement
  121.     ENDIF
  122.  
  123.  
  124. ; *****************************************************************************************
  125. ;*
  126. ;* This routine updates the progress bar in the progress dialog.
  127. ;* It is called repeatedly from within your DoTranslateFile routine.
  128. ;* It should be called often, so that the user will get feedback if he tries to cancel.
  129. ;*
  130. ;* Enter:    refNum        translation reference supplied to DoTranslateFile.
  131. ;*            progress    percent complete (0-100)
  132. ;*
  133. ;* Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  134. ;*            returns        noErr, paramErr, or memFullErr
  135. ;
  136.  
  137. ;
  138. ; pascal OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
  139. ;
  140.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  141.         Macro
  142.         _UpdateTranslationProgress
  143.             moveq               #1,D0
  144.             dc.w                $ABFC
  145.         EndM
  146.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  147.         IMPORT_CFM_FUNCTION UpdateTranslationProgress
  148.     ENDIF
  149.  
  150.  
  151.  
  152. ;  ComponentMgr selectors for routines
  153.  
  154. kTranslateGetFileTranslationList EQU    0                    ; component selectors
  155. kTranslateIdentifyFile            EQU        1
  156. kTranslateTranslateFile            EQU        2
  157. kTranslateGetTranslatedFilename    EQU        3
  158. kTranslateGetScrapTranslationList EQU    10                    ; skip to scrap routines
  159. kTranslateIdentifyScrap            EQU        11
  160. kTranslateTranslateScrap        EQU        12
  161.  
  162. ;  Routines to implment in a file translation extension
  163.  
  164.  
  165.  
  166. ;  Routine to implement in a scrap translation extension
  167.  
  168.  
  169.  
  170.  
  171.     ENDIF ; __TRANSLATIONEXTENSIONS__ 
  172.  
  173.